import unittest

def add(a, b):
    return a + b

class TestAdd(unittest.TestCase):
    def test_add01(self):
        result = add(1, 2)
        # 断言，判断结果是否为预期结果
        assert result == 3
    def test_add02(self):
        result = add(3, 4)
        # 断言两者是否相等
        self.assertEqual(result, 7)
    def test_add03(self):
        result = add(5, 6)
        ok = result == 11  # 结果是一个布尔型的值
        self.assertTrue(ok)  # 断言是否为True
        # self.assertFalse() # 断言是否为False
    def test_add04(self):
        # 断言是否为None
        result = 5
        self.assertIsNone(result)  # 断言是否为None
        # self.assertIsNotNone()  # 断言是否不为None
    def test_add05(self):
        result = '登录成功，欢迎回来！xxx'
        # 断言字符串中是否含有登录成功
        # self.assertIn('登录成功', result)
        self.assertIn('登录失败', result)

if __name__ == '__main__':
    unittest.main()